from langchain_community.document_loaders import DirectoryLoader # 导入目录加载器
from langchain_chroma import Chroma
from major.models_manager import embedding_model

loader = DirectoryLoader("docs",show_progress=True) # 传入路径名即可
docs = loader.load() # .load()

# 需求：用这些文档构建文档库，并持久化保存
Chroma.from_documents(docs,
                      embedding=embedding_model.get_model(),
                      persist_directory='./chroma_db'
                      )